
<template>
  <div>
    <div v-if="Object.keys(commentInfo).length!==0" class="comment-info">
      <div class="info-header">
        <div class="header-title">用户评价</div>
        <div class="more">更多 ></div>
      </div>
      <div class="user-info">
        <img :src="commentInfo.user.avatar" alt="" >
        <div>{{commentInfo.user.uname}} </div>
      </div>
      <div class="comment">
        <p class="content">{{commentInfo.content}}</p>
        <br/>
        <div class="shop-style">
          {{commentInfo.created | showDate}}{{commentInfo.style}}
        </div>
        <div class="info-imgs">
          <img :src="item" alt="" v-for="(item,index) in commentInfo.images">
        </div>

      </div>
    </div>

  </div>
</template>

<script>
  export default {
    name: "DetailCommentInfo",
    props: {
      commentInfo: {
        type: Object,
        default() {
          return {}
        }
      }
    },
    filters:{
      showDate(value){
        const data =new Date(value*1000)
        const year = data.getFullYear()
        const month = data.getMonth()+1
        const day = data.getDate()
        const hours = data.getHours()
        const  minutes = data.getMinutes()
        return (year+'-'+month+'-'+day+' '+hours+':'+minutes+'   ')
      }
    }
  }
</script>

<style scoped>
  .comment-info{
    width: 100%;
    height: 340px;
    border-bottom: 3px solid #e6e6e6;
  }
  .info-header {
    height: 40px;
    width: 100%;
    line-height: 40px;
    padding:0 8px;
    border-bottom: 1px solid #e6e6e6;
  }
  .header-title{
    float: left;

  }
  .more{
    float: right;
  }
  .user-info{
    width: 100%;
    height: 50px;
    padding: 8px;
    line-height: 50px;
    display: flex;
    font-size: 16px;
  }
  .user-info img{
    height: 50px;
    border-radius: 50%;
    margin-right: 10px;
  }
  .comment{
    width: 100%;
    height: 100px;
    padding:15px 8px;
  }
  .shop-style{
    color: #828081;
    margin-bottom: 10px;
  }
  .info-imgs{
    height: 100px;
    display: flex;
  }
  .info-imgs img{
    height: 100px;
  }

</style>